﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SPMS.Log.Repository;

namespace SPMS.Log.Core
{
    /// <summary>
    /// 日志记录器接口
    /// </summary>
    /// <remarks>通过实现日志输出接口来输出日志信息</remarks>
    /// <history>
    /// [zanezeng]               2009/9/22 17:31    创建
    /// </history>
    public interface ILogger
    {
        #region ---Property

        /// <summary>
        /// 获得日志记录器的名称
        /// </summary>
        /// <value></value>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/9/24 11:54    创建
        /// </history>
        string Name
        {
            get;
        }

        /// <summary>
        /// 获得日志记录器所属的存储器
        /// </summary>
        /// <value>日志记录器所属的存储器</value>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/10/13 15:19    创建
        /// </history>
        ILoggingRepository Repository
        {
            get;
        }

        /// <summary>
        /// 获得或者设置当前日志记录器允许输出的最低日志级别
        /// </summary>
        /// <value>当前日志记录器允许输出的最低日志级别</value>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2010/1/8 11:31    创建
        /// </history>
        Level Threshold
        {
            get;
            set;
        }

        #endregion

        #region ---Method

        /// <summary>
        /// 判断当前日志记录器是否能够记录给定级别的日志信息
        /// </summary>
        /// <param name="level">用于判定的日志级别</param>
        /// <returns>
        /// 	<c>true</c>：允许记录<br/>
        /// 	<c>false</c>：不允许记录
        /// </returns>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/9/24 17:12    创建
        /// </history>
        bool IsLevelEnabled( Level level );

        /// <summary>
        /// 将给定的日志信息记录到当前日志记录器中
        /// </summary>
        /// <param name="entry">要记录的日志条目</param>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/9/24 17:15    创建
        /// </history>
        void WriteLog( LogEntry entry );

        /// <summary>
        /// 将给定的日志信息记录到当前日志记录器中
        /// </summary>
        /// <param name="stackBoundaryType">调用堆栈分界类型</param>
        /// <param name="level">日志消息的级别</param>
        /// <param name="message">日志消息包含的消息对象</param>
        /// <param name="exception">日志消息包含的异常信息</param>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/10/13 15:08    创建
        /// </history>
        void WriteLog( Type stackBoundaryType, Level level, object message, Exception exception );

        /// <summary>
        /// 关闭当前日志记录器
        /// </summary>
        /// <remarks></remarks>
        /// <history>
        /// [zanezeng]               2009/10/19 9:50    创建
        /// </history>
        void Close();

        #endregion
    }
}
